<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>Tk_GetAnchorFromObj manual page - Tk Library Procedures</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tk C API</a> <small>&gt;</small> GetAnchor</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<DL>
<DD><A HREF="GetAnchor.htm#M2" NAME="L228">NAME</A>
<DL><DD>Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor &mdash; translate between strings and anchor positions</DD></DL>
<DD><A HREF="GetAnchor.htm#M3" NAME="L229">SYNOPSIS</A>
<DL>
<DD><B>#include &lt;tk.h&gt;</B>
<DD>int
<DD><B>Tk_GetAnchorFromObj(</B><I>interp, objPtr, anchorPtr</I><B>)</B>
<DD>int
<DD><B>Tk_GetAnchor(</B><I>interp, string, anchorPtr</I><B>)</B>
<DD>const char *
<DD><B>Tk_NameOfAnchor(</B><I>anchor</I><B>)</B>
</DL>
<DD><A HREF="GetAnchor.htm#M4" NAME="L230">ARGUMENTS</A>
<DL class="arguments">
</DL>
<DD><A HREF="GetAnchor.htm#M5" NAME="L231">DESCRIPTION</A>
<DD><A HREF="GetAnchor.htm#M6" NAME="L232">KEYWORDS</A>
</DL>
<H3><A NAME="M2">NAME</A></H3>
Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor &mdash; translate between strings and anchor positions
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tk.h&gt;</B><BR>
int<BR>
<B>Tk_GetAnchorFromObj(</B><I>interp, objPtr, anchorPtr</I><B>)</B><BR>
int<BR>
<B>Tk_GetAnchor(</B><I>interp, string, anchorPtr</I><B>)</B><BR>
const char *<BR>
<B>Tk_NameOfAnchor(</B><I>anchor</I><B>)</B><BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL class="arguments">
<DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD>
Interpreter to use for error reporting, or NULL.
<P><DT><A HREF="../TclLib/Object.htm">Tcl_Obj</A> <B>*objPtr</B> (in/out)<DD>
String value contains name of anchor point:
&ldquo;<B>n</B>&rdquo;,
&ldquo;<B>ne</B>&rdquo;,
&ldquo;<B>e</B>&rdquo;,
&ldquo;<B>se</B>&rdquo;,
&ldquo;<B>s</B>&rdquo;,
&ldquo;<B>sw</B>&rdquo;,
&ldquo;<B>w</B>&rdquo;,
&ldquo;<B>nw</B>&rdquo;,
or
&ldquo;<B>center</B>&rdquo;;
internal rep will be modified to cache corresponding Tk_Anchor. In the
case of
&ldquo;<B>center</B>&rdquo;
on input, a non-empty abbreviation of it may also be used on input.
<P><DT>const char <B>*string</B> (in)<DD>
Same as <I>objPtr</I> except description of anchor point is passed as
a string.
<P><DT>int <B>*anchorPtr</B> (out)<DD>
Pointer to location in which to store anchor position corresponding to
<I>objPtr</I> or <I>string</I>.
<P><DT>Tk_Anchor <B>anchor</B> (in)<DD>
Anchor position, e.g. <B>TCL_ANCHOR_CENTER</B>.
<P></DL>
<H3><A NAME="M5">DESCRIPTION</A></H3>
<B>Tk_GetAnchorFromObj</B> places in <I>*anchorPtr</I> an anchor position
(enumerated type <B>Tk_Anchor</B>)
corresponding to <I>objPtr</I>'s value.  The result will be one of
<B>TK_ANCHOR_N</B>, <B>TK_ANCHOR_NE</B>, <B>TK_ANCHOR_E</B>, <B>TK_ANCHOR_SE</B>,
<B>TK_ANCHOR_S</B>, <B>TK_ANCHOR_SW</B>, <B>TK_ANCHOR_W</B>, <B>TK_ANCHOR_NW</B>,
or <B>TK_ANCHOR_CENTER</B>.
Anchor positions are typically used for indicating a point on an object
that will be used to position the object, e.g. <B>TK_ANCHOR_N</B> means
position the top center point of the object at a particular place.
<P>
Under normal circumstances the return value is <B><A HREF="../TclCmd/catch.htm">TCL_OK</A></B> and
<I>interp</I> is unused.
If <I>string</I> does not contain a valid anchor position
or an abbreviation of one of these names, <B><A HREF="../TclCmd/catch.htm">TCL_ERROR</A></B> is returned,
<I>*anchorPtr</I> is unmodified, and an error message is
stored in <I>interp</I>'s result if <I>interp</I> is not NULL.
<B>Tk_GetAnchorFromObj</B> caches information about the return
value in <I>objPtr</I>, which speeds up future calls to
<B>Tk_GetAnchorFromObj</B> with the same <I>objPtr</I>.
<P>
<B>Tk_GetAnchor</B> is identical to <B>Tk_GetAnchorFromObj</B> except
that the description of the anchor is specified with a string instead
of an object.  This prevents <B>Tk_GetAnchor</B> from caching the
return value, so <B>Tk_GetAnchor</B> is less efficient than
<B>Tk_GetAnchorFromObj</B>.
<P>
<B>Tk_NameOfAnchor</B> is the logical inverse of <B>Tk_GetAnchor</B>.
Given an anchor position such as <B>TK_ANCHOR_N</B> it returns a
statically-allocated string corresponding to <I>anchor</I>.
If <I>anchor</I> is not a legal anchor value, then
&ldquo;unknown anchor position&rdquo;
is returned.
<H3><A NAME="M6">KEYWORDS</A></H3>
<A href="../Keywords/A.htm#anchor position">anchor position</A>
<div class="copy">Copyright &copy; 1990 The Regents of the University of California.
<BR>Copyright &copy; 1994-1998 Sun Microsystems, Inc.
</div>
</BODY></HTML>
